/*
 * $Id: niv.h,v 1.8.6.2 Broadcom SDK $
 * 
 * $Copyright: Copyright 2011 Broadcom Corporation.
 * This program is the proprietary software of Broadcom Corporation
 * and/or its licensors, and may only be used, duplicated, modified
 * or distributed pursuant to the terms and conditions of a separate,
 * written license agreement executed between you and Broadcom
 * (an "Authorized License").  Except as set forth in an Authorized
 * License, Broadcom grants no license (express or implied), right
 * to use, or waiver of any kind with respect to the Software, and
 * Broadcom expressly reserves all rights in and to the Software
 * and all intellectual property rights therein.  IF YOU HAVE
 * NO AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS SOFTWARE
 * IN ANY WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE
 * ALL USE OF THE SOFTWARE.  
 *  
 * Except as expressly set forth in the Authorized License,
 *  
 * 1.     This program, including its structure, sequence and organization,
 * constitutes the valuable trade secrets of Broadcom, and you shall use
 * all reasonable efforts to protect the confidentiality thereof,
 * and to use this information only in connection with your use of
 * Broadcom integrated circuit products.
 *  
 * 2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS
 * PROVIDED "AS IS" AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES,
 * REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY,
 * OR OTHERWISE, WITH RESPECT TO THE SOFTWARE.  BROADCOM SPECIFICALLY
 * DISCLAIMS ANY AND ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY,
 * NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES,
 * ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
 * CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING
 * OUT OF USE OR PERFORMANCE OF THE SOFTWARE.
 * 
 * 3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL
 * BROADCOM OR ITS LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL,
 * INCIDENTAL, SPECIAL, INDIRECT, OR EXEMPLARY DAMAGES WHATSOEVER
 * ARISING OUT OF OR IN ANY WAY RELATING TO YOUR USE OF OR INABILITY
 * TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF
 * THE AMOUNT ACTUALLY PAID FOR THE SOFTWARE ITSELF OR USD 1.00,
 * WHICHEVER IS GREATER. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING
 * ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.$
 * 
 * DO NOT EDIT THIS FILE!
 * This file is auto-generated.
 * Edits to this file will be lost when it is regenerated.
 */

#ifndef __BCM_NIV_H__
#define __BCM_NIV_H__

#if defined(INCLUDE_L3)

#include <bcm/types.h>

/* BCM_NIV_* flags. */
#define BCM_NIV_PORT_WITH_ID    (1 << 0)   /* create niv port with specified ID */

/* BCM_NIV_* flags. */
#define BCM_NIV_PORT_REPLACE    (1 << 1)   /* Replace existing entry */

/* BCM_NIV_* flags. */
#define BCM_NIV_PORT_MULTICAST  (1 << 2)   /* Create multicast type */

/* BCM_NIV_FORWARD_* flags. */
#define BCM_NIV_FORWARD_REPLACE (1 << 1)   /* Replace existing entry */

/* BCM_NIV_FORWARD_* flags. */
#define BCM_NIV_FORWARD_MULTICAST   (1 << 2)   /* Create multicast type */

/* NIV port type. */
typedef struct bcm_niv_port_s {
    uint32 flags;                   /* BCM_NIV_PORT_xxx. */
    bcm_gport_t niv_port_id;        /* GPORT identifier. */
    bcm_gport_t port;               /* Physical port / trunk */
    uint16 virtual_interface_id;    /* Virtual Interface Identifier. */
} bcm_niv_port_t;

/* NIV forwarding table. */
typedef struct bcm_niv_forward_s {
    uint32 flags;                   /* BCM_NIV_FORWARD_xxx. */
    uint16 name_space;              /* NIV Namespace. */
    uint16 virtual_interface_id;    /* Virtual Interface Identifier. */
    bcm_gport_t dest_port;          /* Destination Gport. */
    bcm_multicast_t dest_multicast; /* Destination Multicast Group. */
} bcm_niv_forward_t;

#ifndef BCM_HIDE_DISPATCHABLE

/* Initialize niv module. */
extern int bcm_niv_init(
    int unit);

/* Detach niv module. */
extern int bcm_niv_cleanup(
    int unit);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Initialize the NIV port structure. */
extern void bcm_niv_port_t_init(
    bcm_niv_port_t *niv_port);

#ifndef BCM_HIDE_DISPATCHABLE

/* Create NIV port */
extern int bcm_niv_port_add(
    int unit, 
    bcm_niv_port_t *niv_port);

/* Delete NIV port. */
extern int bcm_niv_port_delete(
    int unit, 
    bcm_gport_t niv_port_id);

/* Delete all NIV ports. */
extern int bcm_niv_port_delete_all(
    int unit);

/* Get NIV Port information */
extern int bcm_niv_port_get(
    int unit, 
    bcm_niv_port_t *niv_port);

#endif /* BCM_HIDE_DISPATCHABLE */

/* NIV port traverse function prototype. */
typedef int (*bcm_niv_port_traverse_cb)(
    int unit, 
    bcm_niv_port_t *niv_port, 
    void *user_data);

#ifndef BCM_HIDE_DISPATCHABLE

/* bcm_niv_port_traverse */
extern int bcm_niv_port_traverse(
    int unit, 
    bcm_niv_port_traverse_cb cb, 
    void *user_data);

#endif /* BCM_HIDE_DISPATCHABLE */

/* Initialize the NIV port structure. */
extern void bcm_niv_forward_t_init(
    bcm_niv_forward_t *iv_fwd_entry);

#ifndef BCM_HIDE_DISPATCHABLE

/* Create NIV forwarding table entry */
extern int bcm_niv_forward_add(
    int unit, 
    bcm_niv_forward_t *iv_fwd_entry);

/* Delete NIV forwarding table entry. */
extern int bcm_niv_forward_delete(
    int unit, 
    bcm_niv_forward_t *iv_fwd_entry);

/* Delete all NIV forwarding table entries. */
extern int bcm_niv_forward_delete_all(
    int unit);

/* Get NIV forward information */
extern int bcm_niv_forward_get(
    int unit, 
    bcm_niv_forward_t *iv_fwd_entry);

#endif /* BCM_HIDE_DISPATCHABLE */

/* NIV forward traverse function prototype. */
typedef int (*bcm_niv_forward_traverse_cb)(
    int unit, 
    bcm_niv_forward_t *iv_fwd_entry, 
    void *user_data);

#ifndef BCM_HIDE_DISPATCHABLE

/* bcm_niv_forward_traverse */
extern int bcm_niv_forward_traverse(
    int unit, 
    bcm_niv_forward_traverse_cb cb, 
    void *user_data);

#endif /* defined(INCLUDE_L3) */

#endif /* BCM_HIDE_DISPATCHABLE */

#endif /* __BCM_NIV_H__ */
